package bootstrap

import (
	"el/config"
	"el/routes"
	"log"
	"os"

	"github.com/labstack/echo/v4"
)

func App(HttpServer *echo.Echo) {
	serverConfig := config.GetServerConfig()
	HttpServer = echo.New()

	routes.RouterRegister(HttpServer)
	host := serverConfig["HOST"] + ":" + serverConfig["PORT"]
	err := HttpServer.Start(host)
	if err != nil {
		log.Println("http服务遇到错误，运行中断：", err.Error())
		os.Exit(200)
	}
}
